#pragma once

#include <stdint.h>

#include "hawking/util/node_content.pb.h"

namespace hawking {
namespace indexlib {

class AttributeFilter {
public:
    AttributeFilter(
        const util::FieldValue& filter_field_value,
        const util::FieldValue& index_field_value,
        util::ExpressionOp op,
        util::ColumnType field_type,
        bool is_where) :
            filter_field_value_(filter_field_value),
            index_field_value_(index_field_value),
            op_(op), field_type_(field_type),
            is_where_(is_where) {}
    ~AttributeFilter() = default;

    bool DoFilter() const;

private:
    bool DoFilter_() const;
    bool EqualCompare_() const;
    bool GreaterCompare_() const;
    bool LowerCompare_() const;
    bool InCompare_() const;
    bool ContainCompare_() const;
    bool IntersectCompare_() const;

    const util::FieldValue& filter_field_value_;
    const util::FieldValue& index_field_value_;
    util::ExpressionOp op_;
    util::ColumnType field_type_;
    bool is_where_ = false;
};

}
}
